#include<iostream>
#include<stdlib.h>
using namespace std;
char *strcat(char*a,char*b)
{
	int n1=0,n2=0;
	char *p1=a;
	char *p2=b;
	while(*p1!='\0')
	{
		n1++;
		p1++;
	}
	while(*p2!='\0')
	{
		n2++;
		p2++;
	}
	char*q=(char*)malloc(sizeof(char)*(n1+n2+1));
	int i=0;
	for(;i<n1;i++)
		q[i]=a[i];
	int j=0;
	for(;j<n2;j++)
		q[j+i]=b[j];
	q[j+i]='\0';
	return q;
}
int main()
{
	char*a="hello ";
	char*b="world!";
	cout<<strcat(a,b);
} 
